package io.sage.modules.camera.service.impl;

import io.sage.modules.camera.entity.BMonitorCamersHistory;
import io.sage.modules.camera.dao.BMonitorCamersHistoryMapper;
import io.sage.modules.camera.service.BMonitorCamersHistoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * 摄像头拍照和摄像纪律页面(BMonitorCamersHistory)表服务实现类
 *
 * @author zxh
 * @since 2019-08-12 09:33:04
 */
@Service("bMonitorCamersHistoryService")
public class BMonitorCamersHistoryServiceImpl implements BMonitorCamersHistoryService {
    @Resource
    private BMonitorCamersHistoryMapper bMonitorCamersHistoryMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BMonitorCamersHistory queryById(Integer id) {
        return this.bMonitorCamersHistoryMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<BMonitorCamersHistory> queryAllByLimit(int offset, int limit) {
        return this.bMonitorCamersHistoryMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param bMonitorCamersHistory 实例对象
     * @return 实例对象
     */
    @Override
    public BMonitorCamersHistory insert(BMonitorCamersHistory bMonitorCamersHistory) {
        this.bMonitorCamersHistoryMapper.insert(bMonitorCamersHistory);
        return bMonitorCamersHistory;
    }

    /**
     * 修改数据
     *
     * @param bMonitorCamersHistory 实例对象
     * @return 实例对象
     */
    @Override
    public BMonitorCamersHistory update(BMonitorCamersHistory bMonitorCamersHistory) {
        this.bMonitorCamersHistoryMapper.update(bMonitorCamersHistory);
        return this.queryById(bMonitorCamersHistory.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.bMonitorCamersHistoryMapper.deleteById(id) > 0;
    }

    @Override
    public List<BMonitorCamersHistory> selectByMap(HashMap<String, Object> paramMap) {

        return this.bMonitorCamersHistoryMapper.selectByMap(paramMap);
    }

    @Override
    public int deleteBatchIds(List<Integer> asList) {
        int j=0;
        for (int i = 0; i < asList.size(); i++) {

        }
        return j;
    }
}